<template>
  <div class="dashboard-editor-container" :style="{backgroundImage: 'url(' + bgImg + ')' }">

    <el-col :span="12">
      <el-form ref="editForm" :model="userInfo" status-icon label-position="left"
               label-width="100px" style="width: 400px; margin-left:50px;">
        <el-form-item label="用户名" prop="account">
          <span>{{userInfo.userName}}</span>
        </el-form-item>
        <el-form-item v-if="userInfo.nickname" label="昵称" prop="name">
          <span>{{userInfo.nickname}}</span>
        </el-form-item>
        <el-form-item v-if="userInfo.realName" label="真实姓名" prop="realName">
          <span>{{userInfo.realName}}</span>
        </el-form-item>
        <el-form-item label="上次登陆时间" prop="name">
          <span>{{userInfo.timeLastLogin}}</span>
        </el-form-item>
      </el-form>
    </el-col>

  </div>
</template>

<script>
    // import { info } from '@/api/dashboard'
    import {doGet, doPost} from '@/api'
    import CountTo from 'vue-count-to'
    import bgImg from '../../assets/bkg-my.png'

    export default {
        components: {
            CountTo
        },
        data() {
            return {
                bgImg: bgImg,
                userInfo: {
                    userName: undefined,
                    nickname: undefined,
                    realName: undefined,
                    timeLastLogin: undefined
                }
            }
        },
        created() {
            doPost('userinfo.html', {}).then(response => {
                this.userInfo = response.data
            }).catch(error => {
                reject(error)
            })
        },
        methods: {
            handleSetLineChartData(type) {
                this.$emit('handleSetLineChartData', type)
            }
        }
    }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

  .dashboard-editor-container {
    padding: 220px 90px 650px;
    background-color: #fff;
    background-repeat: no-repeat;
    background-size: cover;

    .chart-wrapper {
      background: #fff;
      padding: 16px 16px 0;
      margin-bottom: 32px;
    }
  }

  .panel-group {
    margin-top: 18px;

    .card-panel-col {
      margin-bottom: 32px;
    }

    .card-panel {
      height: 108px;
      cursor: pointer;
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      background: #fff;
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
      border-color: rgba(0, 0, 0, .05);

      &:hover {
        .card-panel-icon-wrapper {
          color: #fff;
        }

        .icon-people {
          background: #40c9c6;
        }

        .icon-message {
          background: #36a3f7;
        }

        .icon-money {
          background: #f4516c;
        }

        .icon-shoppingCard {
          background: #34bfa3
        }
      }

      .icon-people {
        color: #40c9c6;
      }

      .icon-message {
        color: #36a3f7;
      }

      .icon-money {
        color: #f4516c;
      }

      .icon-shoppingCard {
        color: #34bfa3
      }

      .card-panel-icon-wrapper {
        float: left;
        margin: 14px 0 0 14px;
        padding: 16px;
        transition: all 0.38s ease-out;
        border-radius: 6px;
      }

      .card-panel-icon {
        float: left;
        font-size: 48px;
      }

      .card-panel-description {
        float: right;
        font-weight: bold;
        margin: 26px;
        margin-left: 0px;

        .card-panel-text {
          line-height: 18px;
          color: rgba(0, 0, 0, 0.45);
          font-size: 16px;
          margin-bottom: 12px;
        }

        .card-panel-num {
          font-size: 20px;
        }
      }
    }
  }
</style>
